package server;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.rmi.Naming;

/**
 *
 * @author jfdenise
 */
public class Server {
    private static String OS = System.getProperty("os.name").toLowerCase();
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        try {
            MonitorImpl monit = null;
            if(OS.indexOf("win") >= 0) 
                monit = new WindowsMonitorImpl(); 
            else
                if((OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 ))
                        monit = new LinuxMonitorImpl();
//            CpuImpl cpu = new CpuImpl();
            
            // Bind this object instance to the name "HelloServer"
            Naming.rebind("//localhost/Monitor", monit);
//            Naming.rebind("//localhost/Cpu", cpu);

            System.out.println("HelloServer bound in registry");
        } catch (Exception e) {
            System.out.println("HelloImpl err: " + e.getMessage());
            e.printStackTrace();
        }
    }
}
